package com.java.mybatis.service.impl;

import com.java.mybatis.dao.PutinlocationDao;
import com.java.mybatis.entity.Putinlocation;
import com.java.mybatis.service.PutinlocationService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Putinlocation)表服务实现类
 *
 * @author makejava
 * @since 2021-01-15 17:10:27
 */
@Service("putinlocationService")
public class PutinlocationServiceImpl implements PutinlocationService {
    @Resource
    private PutinlocationDao putinlocationDao;

    /**
     * 通过ID查询单条数据
     *
     * @param putinlocationId 主键
     * @return 实例对象
     */
    @Override
    public Putinlocation queryById(Integer putinlocationId) {
        return this.putinlocationDao.queryById(putinlocationId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<Putinlocation> queryAllByLimit(int offset, int limit) {
        return this.putinlocationDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param putinlocation 实例对象
     * @return 实例对象
     */
    @Override
    public Putinlocation insert(Putinlocation putinlocation) {
        this.putinlocationDao.insert(putinlocation);
        return putinlocation;
    }

    /**
     * 修改数据
     *
     * @param putinlocation 实例对象
     * @return 实例对象
     */
    @Override
    public Putinlocation update(Putinlocation putinlocation) {
        this.putinlocationDao.update(putinlocation);
        return this.queryById(putinlocation.getPutinlocationId());
    }

    /**
     * 通过主键删除数据
     *
     * @param putinlocationId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer putinlocationId) {
        return this.putinlocationDao.deleteById(putinlocationId) > 0;
    }

    @Override
    public Integer SelPutCount() throws Exception {
        return this.putinlocationDao.SelPutCount();
    }

    @Override
    public void UpdateCode(String time,Integer id) throws Exception {
        this.putinlocationDao.UpdateCode(time,id);
    }

    @Override
    public Integer upPutCode(Integer id) throws Exception {
        return this.putinlocationDao.upPutCode(id);
    }

    @Override
    public Integer updateLocationState(Integer id) throws Exception {
        return this.putinlocationDao.updateLocationState(id);
    }

    @Override
    public Integer selLikeCount(String name) throws Exception {
        return this.putinlocationDao.selLikeCount(name);
    }

    @Override
    public List<Putinlocation> selNameLike(String name,Integer page,Integer size) throws Exception {
        return this.putinlocationDao.selNameLike(name,page,size);
    }

    @Override
    public List<Putinlocation> getAllPutIn(Integer page,Integer size) throws Exception {
        return this.putinlocationDao.getAllPutIn(page,size);
    }

    /**
     * 查询最大id
     * @return
     */
    @Override
    public Integer queryByMaxId(){
        return putinlocationDao.queryByMaxId();
    }
}